package com.aquan.spring.sample.circul;

import com.aquan.spring.sample.circul.beans.ServiceB;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 循环依赖（二级缓存）
 */
public class Application {

    public static void main(String[] args) {
        // 2.5.3 只支持到 1.7
        System.setProperty("java.version","1.7.5");
        ClassPathXmlApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");

        ServiceB bean = (ServiceB) app.getBean("serviceB", ServiceB.class);
        System.out.println("beanB = " + bean.getClass());
        bean.sayHelloFromB();
        System.out.println("beanC = " + bean.getServiceC().getClass());
        bean.getServiceC().sayHelloFromC();
        System.out.println("beanA = " + bean.getServiceC().getServiceA().getClass());
        bean.getServiceC().getServiceA().sayHelloFromA();


    }


}
